# Written by koya
# -*- coding: utf8 -*-

#sound.py

import os

import pygame
from pygame.locals import *



#载入声音,音乐文件的函数
def load_sound( filename, volume = 1.0, path = "data" ):

    sound = pygame.mixer.Sound(os.path.join(path, filename))
    sound.set_volume(volume)

    return sound


def play_music( filename, loop = True, path = "data" ):

    pygame.mixer.music.load(os.path.join(path, filename))
      
    if loop:
        
        pygame.mixer.music.play(-1)

    else:

        pygame.mixer.music.play()
